//package com.ruoyi.gateway.filter;
//
//import java.util.ArrayList;
//import java.util.List;
//import java.util.regex.Pattern;
//
//import com.ruoyi.gateway.config.properties.BlackProperties;
//import lombok.Data;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.boot.context.properties.ConfigurationProperties;
//import org.springframework.cloud.context.config.annotation.RefreshScope;
//import org.springframework.cloud.gateway.filter.GatewayFilter;
//import org.springframework.cloud.gateway.filter.factory.AbstractGatewayFilterFactory;
//import org.springframework.stereotype.Component;
//import com.ruoyi.common.core.utils.ServletUtils;
//
//import javax.annotation.PostConstruct;
//
///**
// * 黑名单过滤器
// *
// * @author ruoyi
// */
//@Component
//@Data
//@Slf4j
//public class BlackListUrlFilter extends AbstractGatewayFilterFactory<BlackProperties>
//{
//    @Override
//    public GatewayFilter apply(BlackProperties config)
//    {
//        log.info("黑名单过滤器初始化完成，config.getBlacklistUrl()={}",config.getBlacklistUrl());
//        return (exchange, chain) -> {
//
//            String url = exchange.getRequest().getURI().getPath();
//            if (config.matchBlacklist(url))
//            {
//                return ServletUtils.webFluxResponseWriter(exchange.getResponse(), "请求地址不允许访问");
//            }
//
//            return chain.filter(exchange);
//        };
//    }
//
//    public BlackListUrlFilter()
//    {
//
//    }
//}
